# name : SQL count(unique()), grouped
# key : sql.count.unique.grouped
# contributor: Shuguang Sun
# --
proc sql;
  create table ${1:dtout} as
    select distinct ${3:groupby}, ${4:cat}, count(unique($4)) as n
    from ${2:dtin}
    group by $3;
  quit;
run;